package com.item.web.sys_user.entity;


import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;
import java.util.List;

@Data
@TableName("sys_user")
@ApiModel(value = "SysUser", description = "用户实体")
public class SysUser implements UserDetails {
    @TableId(type = IdType.AUTO)
    private Long userId;
    //排除roleId，该字段不属于sys_user表
    @TableField(exist = false)
    private Long roleId;
    private String username;
    private String password;
    private String phone;
    private String email;
    private String sex;
    private String isAdmin;
     //帐户是否过期(1 未过期，0已过期)
    private boolean isAccountNonExpired = true;
    //帐户是否被锁定(1 未锁定，0已锁定)
    private boolean isAccountNonLocked = true;
    //密码是否过期(1 未过期，0已过期)
    private boolean isCredentialsNonExpired = true;
    //帐户是否可用(1 可用，0 删除用户)
    private boolean isEnabled = true;
    //帐户是否可用(1 逻辑删除，0 未删除)
    @TableLogic
    private Integer isDeleted;
    private String nickName;
    //创建时间
    private Date createTime;
    //更新时间
    private Date updateTime;
    //用户角色
    @TableField(exist = false)
    public String roleName;
     //用户权限字段的集合
    @TableField(exist = false)
     Collection<? extends GrantedAuthority> authorities;
}